package org.qfedu.edu.impl;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import org.qfedu.edu.service.IJwtService;
import org.qfedu.edu.service.ITokenService;

/**
 * @author xiaobobo
 * @title: JwtService
 * @projectName seckill-fy-2401-parent
 * @description: TODO
 * @date 2024/11/4  14:09
 */
public class JwtService implements IJwtService {

    private ITokenService tokenService;

    public JwtService(ITokenService tokenService){
      this.tokenService=tokenService;
    }

    @Override
    public String getUserId(String token) {
        return tokenService.parseToken(token).getBody().getId();
    }

    @Override
    public String getUsername(String token) {
        return tokenService.parseToken(token).getBody().getSubject();
    }
}
